package janelas;

import controladoresBD.CursoJpaController;
import controladoresBD.exceptions.NonexistentEntityException;
import estrutura.Curriculo;
import estrutura.Curso;
import estrutura.Grafo;
import java.awt.Color;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JOptionPane;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Gustavo
 */
public class JanelaPrincipal extends javax.swing.JFrame {
    private EntityManagerFactory emf;
    private CursoJpaController cursoController;
    private Grafo grafo;
    private Curriculo curriculo;
    private Curso curso;
    private int cod=0;
    
    private int contclick=0;
    
    
    
    /**
     * Creates new form Interface
     */
    public JanelaPrincipal() {
        emf = Persistence.createEntityManagerFactory("Modulo10PU");
        cursoController = new CursoJpaController(emf);
        grafo = new Grafo(emf);
        this.setLocationRelativeTo(null); 
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        abrir = new javax.swing.JFileChooser();
        salvar = new javax.swing.JFileChooser();
        periodo = new javax.swing.ButtonGroup();
        Calcular = new javax.swing.JButton();
        mateira = new javax.swing.JPanel();
        CampoTexto = new javax.swing.JTextField();
        Adicionar = new javax.swing.JButton();
        Limpar = new javax.swing.JButton();
        cursos = new javax.swing.JPanel();
        opcoes = new javax.swing.JComboBox();
        selcur = new javax.swing.JLabel();
        selper = new javax.swing.JLabel();
        primeiro = new javax.swing.JRadioButton();
        segundo = new javax.swing.JRadioButton();
        materias = new javax.swing.JPanel();
        listamat = new javax.swing.JScrollPane();
        lista = new javax.swing.JList();
        apagar = new javax.swing.JButton();
        Remover = new javax.swing.JButton();
        BarraMenu = new javax.swing.JMenuBar();
        Arquivo = new javax.swing.JMenu();
        Importar = new javax.swing.JMenuItem();
        Exportar = new javax.swing.JMenuItem();
        Separador = new javax.swing.JPopupMenu.Separator();
        Sair = new javax.swing.JMenuItem();

        abrir.setDialogTitle("Importar Arquivo");
        abrir.setFileFilter( new MyCustomFilter());

        salvar.setDialogType(javax.swing.JFileChooser.SAVE_DIALOG);
        salvar.setFileFilter( new MyCustomFilter());
        salvar.setSelectedFile(new java.io.File("/home/fabio/Lista1.txt"));

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Módulo 10");

        Calcular.setText("Calcular");
        Calcular.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                CalcularActionPerformed(evt);
            }
        });

        mateira.setBorder(javax.swing.BorderFactory.createTitledBorder("Adicione as materias"));

        CampoTexto.setForeground(new java.awt.Color(204, 204, 204));
        CampoTexto.setText("XXYYY");
        CampoTexto.setCursor(new java.awt.Cursor(java.awt.Cursor.TEXT_CURSOR));
        CampoTexto.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                CampoTextoMouseClicked(evt);
            }
        });
        CampoTexto.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                CampoTextoKeyTyped(evt);
            }
        });

        Adicionar.setText("Adicionar");
        Adicionar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                AdicionarActionPerformed(evt);
            }
        });

        Limpar.setText("Limpar");
        Limpar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                LimparActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout mateiraLayout = new javax.swing.GroupLayout(mateira);
        mateira.setLayout(mateiraLayout);
        mateiraLayout.setHorizontalGroup(
            mateiraLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(mateiraLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(mateiraLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(mateiraLayout.createSequentialGroup()
                        .addComponent(Adicionar)
                        .addGap(18, 18, 18)
                        .addComponent(Limpar))
                    .addComponent(CampoTexto, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(0, 14, Short.MAX_VALUE))
        );
        mateiraLayout.setVerticalGroup(
            mateiraLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(mateiraLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(CampoTexto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(mateiraLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(Adicionar)
                    .addComponent(Limpar))
                .addContainerGap(13, Short.MAX_VALUE))
        );

        cursos.setBorder(javax.swing.BorderFactory.createTitledBorder(""));

        opcoes.setModel(new javax.swing.DefaultComboBoxModel(cursoController.findCursoNomes().toArray(new String[cursoController.findCursoNomes().size()])));
        opcoes.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                opcoesActionPerformed(evt);
            }
        });

        selcur.setText("Selecione o curso");

        selper.setText("Selecione o período inicial");

        periodo.add(primeiro);
        primeiro.setSelected(true);
        primeiro.setText("Primeiro");

        periodo.add(segundo);
        segundo.setText("Segundo");

        javax.swing.GroupLayout cursosLayout = new javax.swing.GroupLayout(cursos);
        cursos.setLayout(cursosLayout);
        cursosLayout.setHorizontalGroup(
            cursosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(cursosLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(cursosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(opcoes, javax.swing.GroupLayout.PREFERRED_SIZE, 159, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(selcur)
                    .addGroup(cursosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addGroup(cursosLayout.createSequentialGroup()
                            .addComponent(primeiro)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(segundo))
                        .addComponent(selper)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        cursosLayout.setVerticalGroup(
            cursosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(cursosLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(selcur)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(opcoes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(23, 23, 23)
                .addComponent(selper)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(cursosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(primeiro)
                    .addComponent(segundo))
                .addContainerGap(22, Short.MAX_VALUE))
        );

        materias.setBorder(javax.swing.BorderFactory.createTitledBorder("Matérias adicionadas"));

        lista.setToolTipText("");
        listamat.setViewportView(lista);

        apagar.setText("Apagar tudo");
        apagar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                apagarActionPerformed(evt);
            }
        });

        Remover.setText("Remover");
        Remover.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RemoverActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout materiasLayout = new javax.swing.GroupLayout(materias);
        materias.setLayout(materiasLayout);
        materiasLayout.setHorizontalGroup(
            materiasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(materiasLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(listamat, javax.swing.GroupLayout.PREFERRED_SIZE, 203, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, materiasLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(Remover)
                .addGap(18, 18, 18)
                .addComponent(apagar)
                .addContainerGap())
        );
        materiasLayout.setVerticalGroup(
            materiasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(materiasLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(listamat, javax.swing.GroupLayout.PREFERRED_SIZE, 182, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(materiasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(Remover)
                    .addComponent(apagar))
                .addGap(0, 12, Short.MAX_VALUE))
        );

        Arquivo.setText("Arquivo");

        Importar.setText("Importar Lista");
        Importar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ImportarActionPerformed(evt);
            }
        });
        Arquivo.add(Importar);

        Exportar.setText("Exportar Lista");
        Exportar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ExportarActionPerformed(evt);
            }
        });
        Arquivo.add(Exportar);
        Arquivo.add(Separador);

        Sair.setText("Sair");
        Sair.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                SairActionPerformed(evt);
            }
        });
        Arquivo.add(Sair);

        BarraMenu.add(Arquivo);

        setJMenuBar(BarraMenu);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(mateira, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(cursos, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(materias, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(8, 8, 8))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(Calcular)
                        .addContainerGap())))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(mateira, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(cursos, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(materias, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(12, 12, 12)
                .addComponent(Calcular)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void ImportarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ImportarActionPerformed
    if (abrir.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) { //a
        String linha = null;
        String test = null;
        LinkedList<String> linhas = new LinkedList<String>();
        
        try {
            FileReader fr = new FileReader(abrir.getSelectedFile().getPath());
            BufferedReader file_in = new BufferedReader(fr);
            while ((linha = file_in.readLine()) != null) {
                linhas.add(linha);
            }
            
            grafo.addLista(linhas);
            lista.setModel(grafo.getjList());
            JOptionPane.showMessageDialog(null, "Lista Importada"); 
       
        } catch (IOException ex) {
            JOptionPane.showMessageDialog(null, "Acesso Negado"); 
        }
    } else {
        
    }
    }//GEN-LAST:event_ImportarActionPerformed

    private void SairActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SairActionPerformed
        System.exit(0);
    }//GEN-LAST:event_SairActionPerformed

    private void ExportarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ExportarActionPerformed
    if (salvar.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) {
        // indicates whether the user still wants to export the settings
        boolean doExport = true;
        // indicates whether to override an already existing file
        boolean overrideExistingFile = false;
        // get destination file
        File destinationFile = new File(salvar.getSelectedFile().getAbsolutePath());
        // check if file already exists
        while (doExport && destinationFile.exists() && !overrideExistingFile) {
            // let the user decide whether to override the existing file
            overrideExistingFile = (JOptionPane.showConfirmDialog(this, "Substituir arquivo?", "Conflito de arquivo", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION);
            // let the user choose another file if the existing file shall not be overridden
            if (!overrideExistingFile) {
                if (salvar.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) {
                    // get new destination file
                    destinationFile = new File(salvar.getSelectedFile().getAbsolutePath());
                } else {
                    // seems like the user does not want to export the settings any longer
                    doExport = false;
                }
            }
        }
        // perform the actual export
        if (doExport) {
            try {  
                BufferedWriter out = new BufferedWriter(new FileWriter(destinationFile));  
                LinkedList<String> str = new LinkedList<String>();
                String test;
                str = (LinkedList<String>) grafo.getLista();
                Iterator<String> iter1 = str.iterator();
                while(iter1.hasNext()){
                    test = iter1.next();
                    out.write(test.toString());
                    out.newLine();
                }
                out.close();  
                JOptionPane.showMessageDialog(null, "Lista Exportada"); 
            } catch (IOException e) {  
                e.printStackTrace();  
            }  
        }
    }
    }//GEN-LAST:event_ExportarActionPerformed

    private void AdicionarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AdicionarActionPerformed
        
        String materia = CampoTexto.getText();
        CampoTexto.setText("");
        try {
            if(grafo.addDisciplina(materia)){
                lista.setModel(grafo.getjList());
            }else{
                JOptionPane.showMessageDialog(null, "Matéria existente");
                
            }    
        } catch (NonexistentEntityException ex) {
            JOptionPane.showMessageDialog(null, ex.getMessage());
        }
    }//GEN-LAST:event_AdicionarActionPerformed

    private void CalcularActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CalcularActionPerformed
        int periodo = 0;
        int resultado;
        if (cod!=0){
            grafo.constroiArestas();
            Curso curso = cursoController.findCurso(cod);
            curriculo = new Curriculo(grafo, curso);
            if(primeiro.isSelected()){
                periodo=1;
                
            }else if(segundo.isSelected()){
                periodo=2;
           }
            curriculo.criaSemestres(periodo);
            resultado = curriculo.numeroSemestres();
      
        
            JOptionPane.showMessageDialog(null, "Seu tempo minímo para conclusão é de: " + resultado + " semestres");
        }else{
            JOptionPane.showMessageDialog(null, "Selecione o curso");
        }
       
        
        
    }//GEN-LAST:event_CalcularActionPerformed

    private void LimparActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_LimparActionPerformed
       CampoTexto.setText("");
    }//GEN-LAST:event_LimparActionPerformed

    private void RemoverActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RemoverActionPerformed
        try{
            String materia = lista.getSelectedValue().toString();
            if(grafo.delDisciplina(materia)){
                lista.setModel(grafo.getjList());
            }else{
                JOptionPane.showMessageDialog(null, "Matéria não econtrada");
            }
        }catch (NullPointerException e){
        JOptionPane.showMessageDialog(null, "Lista vazia");
        }
    }//GEN-LAST:event_RemoverActionPerformed

    private void opcoesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_opcoesActionPerformed
        String materia = (String) opcoes.getSelectedItem();
        if(materia!=null){
            String codv[] = materia.split(" ");
            cod = Integer.parseInt(codv[0]);
        }else {
            cod=0;
        }
    }//GEN-LAST:event_opcoesActionPerformed

    private void CampoTextoMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_CampoTextoMouseClicked
        if(contclick==0){
            CampoTexto.setText("");
            CampoTexto.setForeground(Color.black);
            contclick++;
        }if(contclick==1){
            CampoTexto.select(0, CampoTexto.getText().length());
            contclick++;
        }
    }//GEN-LAST:event_CampoTextoMouseClicked

    private void CampoTextoKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_CampoTextoKeyTyped
        contclick=1;
    }//GEN-LAST:event_CampoTextoKeyTyped

    private void apagarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_apagarActionPerformed
        grafo.delGrafo();
        lista.setModel(grafo.getjList());
        JOptionPane.showMessageDialog(null, "Árvore Apagada"); 
      
    }//GEN-LAST:event_apagarActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Windows".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(JanelaPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(JanelaPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(JanelaPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(JanelaPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>
        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new JanelaPrincipal().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton Adicionar;
    private javax.swing.JMenu Arquivo;
    private javax.swing.JMenuBar BarraMenu;
    private javax.swing.JButton Calcular;
    private javax.swing.JTextField CampoTexto;
    private javax.swing.JMenuItem Exportar;
    private javax.swing.JMenuItem Importar;
    private javax.swing.JButton Limpar;
    private javax.swing.JButton Remover;
    private javax.swing.JMenuItem Sair;
    private javax.swing.JPopupMenu.Separator Separador;
    private javax.swing.JFileChooser abrir;
    private javax.swing.JButton apagar;
    private javax.swing.JPanel cursos;
    private javax.swing.JList lista;
    private javax.swing.JScrollPane listamat;
    private javax.swing.JPanel mateira;
    private javax.swing.JPanel materias;
    private javax.swing.JComboBox opcoes;
    private javax.swing.ButtonGroup periodo;
    private javax.swing.JRadioButton primeiro;
    private javax.swing.JFileChooser salvar;
    private javax.swing.JRadioButton segundo;
    private javax.swing.JLabel selcur;
    private javax.swing.JLabel selper;
    // End of variables declaration//GEN-END:variables
}
